package com.cms.service;

import com.cms.dao.SysLogDao;
import com.cms.model.bo.ExcelExport;
import com.cms.model.vo.SysLog;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**系统日志Servce*/
@Service
public class SysLogService extends BaseService<SysLog>{

    @Autowired
    private SysLogDao sysLogDao;
    
    /**
     * 日志信息分页显示
     * @param sysLog 日志实体
     * @return
     */
    public String selectSystemLogResultPageList(SysLog sysLog){
    	PageHelper.startPage(sysLog.getPage(),sysLog.getLimit());
    	return setPage(sysLogDao.selectSysLogList(sysLog));
    }

    /**
     * 日志EXCEL导出
     * @param sysLog 日志实体
     * @return
     */
    public ExcelExport excelExportSystemLogList(SysLog sysLog){
        ExcelExport excelExport = new ExcelExport();
        List<SysLog> systemLogList = sysLogDao.selectSysLogList(sysLog);
        excelExport.addColumnInfo("日志标题","logTitle");
        excelExport.addColumnInfo("日志类型","logType_Lable");
        excelExport.addColumnInfo("日志请求URL","logUrl");
        excelExport.addColumnInfo("请求方式","logMethod");
        excelExport.addColumnInfo("请求参数","logParams");
        excelExport.addColumnInfo("请求用户","logUserName");
        excelExport.addColumnInfo("请求时间","logStartTime_Lable");
        excelExport.addColumnInfo("耗时(毫秒)","logElapsedTime");
        excelExport.setDataList(systemLogList);
        return excelExport;
    }

}
